package com.cyandpos.pad.modifypassword.presenter;


import com.cyandpos.pad.modifypassword.model.ModifyPasswordModel;
import com.cyandpos.pad.modifypassword.model.ModifyPasswordModelImpl;
import com.cyandpos.pad.modifypassword.view.ModifyPasswordView;

/**
 * Created by zhangyp on 2017/3/1.
 */

public class ModifyPasswordPresenterImpl implements ModifyPasswordPresenter,ModifyPasswordModelImpl.OnLoadModifyPasswordConfigListener{
    private ModifyPasswordView mModifyPasswordView;
    private ModifyPasswordModel mModifyPasswordModel;
    public ModifyPasswordPresenterImpl(ModifyPasswordView mModifyPasswordView){
        this.mModifyPasswordView = mModifyPasswordView;
        mModifyPasswordModel = new ModifyPasswordModelImpl();

    }
    /**
     *
     * @param oldPassword
     * @param personId
     */
    @Override
    public void ModifyPassword(String newPassword,String oldPassword,String personId) {

        mModifyPasswordView.showProgress();
        mModifyPasswordModel.loadModifyPasswordConfig(newPassword,oldPassword,personId,this);

    }


    @Override
    public void onLoadModifyPasswordSuccess(String mag) {
        mModifyPasswordView.hideProgress();
        mModifyPasswordView.onModifyPasswordSuccess(mag);
    }

    @Override
    public void onLoadModifyPasswordFailure(String errorMsg) {
        //model 网络请求失败
        mModifyPasswordView.hideProgress();
        mModifyPasswordView.showLoadFailMsg(errorMsg);
    }
}
